package org.cloud.mall;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.config.server.EnableConfigServer;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;

/**
 * 配置中心
 * ${like @EnableConfigServer}开启配置中心服务
 * @author Created by John on 2020/5/5
 */
@EnableConfigServer
@EnableEurekaClient
@SpringBootApplication
public class ConfigApplication {

    private static Logger LOGGER = LoggerFactory.getLogger(ConfigApplication.class);

    @Value("${port}")
    static int port;

    public static void main(String[] args) {
        LOGGER.info("======================== 开始启动 Config Server配置中心服务 =====================================");

        /**
         * 集群模式下让用户自己指点 端口号[端口号随意指定，注意不要与本机端口号出现冲突即可]
         * Scanner scanner = new Scanner(System.in);
         * String port = scanner.nextLine(); //让用户指定端口号
         */

        new SpringApplicationBuilder(ConfigApplication.class).properties("server.port=" + port).run(args);//启动项目

        LOGGER.info("======================== Config Server配置中心服务启动成功 ======================================");

    }
}
